/**
 * Licensee: 
 * License Type: Evaluation
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdatePrueba1Data {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm.Prueba1PersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.Com_logDAO lormCom_logDAO = lDAOFactory.getCom_logDAO();
			orm.Com_log lormCom_log = lormCom_logDAO.loadCom_logByQuery(null, null);
			// Update the properties of the persistent object
			lormCom_logDAO.save(lormCom_log);
			orm.dao.Com_precioDAO lormCom_precioDAO = lDAOFactory.getCom_precioDAO();
			orm.Com_precio lormCom_precio = lormCom_precioDAO.loadCom_precioByQuery(null, null);
			// Update the properties of the persistent object
			lormCom_precioDAO.save(lormCom_precio);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Com_log by Com_logCriteria");
		orm.Com_logCriteria lormCom_logCriteria = new orm.Com_logCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//lormCom_logCriteria.log_id_log.eq();
		System.out.println(lormCom_logCriteria.uniqueCom_log());
		
		System.out.println("Retrieving Com_precio by Com_precioCriteria");
		orm.Com_precioCriteria lormCom_precioCriteria = new orm.Com_precioCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//lormCom_precioCriteria.pre_id_precio.eq();
		System.out.println(lormCom_precioCriteria.uniqueCom_precio());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdatePrueba1Data retrieveAndUpdatePrueba1Data = new RetrieveAndUpdatePrueba1Data();
			try {
				retrieveAndUpdatePrueba1Data.retrieveAndUpdateTestData();
				//retrieveAndUpdatePrueba1Data.retrieveByCriteria();
			}
			finally {
				orm.Prueba1PersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
